<?php
function capture($object, $function){
	$args = func_get_args();
	array_shift($args);
	array_shift($args);
	
	ob_start();
	if (count($args)){
		call_user_func_array(array($object, $function), $args);
	}else{
		call_user_func(array($object, $function));
	}
	$output = ob_get_contents();
	ob_end_clean();
	return $output;
}



/**
* Form controll groups
* @param $title Title of the label
* @param $html Html for the form, inputs etc
* @param $labelName Unique label name ( this will need to be specified on the input in $html param
* @param $helpText Text that will explain what this fiend is for
* @return string 
*/
function twitter_ControlGroup($title, $body, $labelName = '', $helpText = ''  ){
	$html = '<div class="control-group">';
	$html .= '<label class="control-label" for="'.$labelName.'" >'.$title.'</label>';
	$html .= '<div class="controls">'.$body;
	$html .= '<span class="help-inline">'.$helpText.'</span>';
	$html .= '</div>';
	$html .= '</div>';
	return $html;
}
/**
* Form actions for forms
* @param $submitText Title for the submit button
* @param $resetText Title for the reset button
* @return string 
*/
function twitter_FormActions($submitText = 'Save changes', $resetText = 'Cancel'){
	$html .= '<div class="form-actions">';
	$html .= '<button type="submit" class="btn btn-primary">'.$submitText.'</button>';
	$html .= '<button type="reset" class="btn">'.$resetText.'</button>';
	$html .= '</div>';
	return $html;
}
?>
